package cn.zwxky.android.user.Search;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.zgscwjm.lsfbbasetemplate.Event.LsfbEvent;
import com.zgscwjm.lsfbbasetemplate.adapter.CommonRecycAdapter;
import com.zgscwjm.lsfbbasetemplate.adapter.ViewHolderRecyc;

import java.util.List;

import cn.zwxky.android.user.R;

import static com.baidu.location.h.j.C;

/**
 * Created by Administrator on 2017/3/27 0027.
 */

public class TypeAdapter extends CommonRecycAdapter<TypeBean.ListBean> {
    private  Context mContext;
    public TypeAdapter(Context context, List<TypeBean.ListBean> list, int layoutId) {
        super(context, list, layoutId);
        mContext=context;
    }

    @Override
    public void convert(final ViewHolderRecyc holder, final TypeBean.ListBean model) {
         holder.setText(R.id.item_text_type,model.getName());
        TextView textView=holder.getView(R.id.item_text_type);
        if (model.check){
            textView.setBackgroundResource(R.color.bottom_unchecked_color2);

        }else {
            textView.setBackgroundResource(R.color.white_color);
        }

        holder.setOnclick(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                TypeClickEvent event = new TypeClickEvent();
                event.setData(model.getId());
                LsfbEvent.getInstantiation().post(event);
            }
        });
    }
}
